package cn.iocoder.yudao.module.myerp.dal.mysql.SPUproduct;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.myerp.dal.dataobject.SPUproduct.ErpProductSpuDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.myerp.controller.admin.SPUproduct.vo.*;

/**
 * ERP SPU级产品 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ErpProductSpuMapper extends BaseMapperX<ErpProductSpuDO> {

    default PageResult<ErpProductSpuDO> selectPage(ErpProductSpuPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ErpProductSpuDO>()
                .eqIfPresent(ErpProductSpuDO::getId, reqVO.getId())
                .eqIfPresent(ErpProductSpuDO::getSpu, reqVO.getSpu())
                .eqIfPresent(ErpProductSpuDO::getShopId, reqVO.getShopId())
                .likeIfPresent(ErpProductSpuDO::getName, reqVO.getName())
                .eqIfPresent(ErpProductSpuDO::getCategoryId, reqVO.getCategoryId())
                .orderByDesc(ErpProductSpuDO::getId));
    }

}